<!doctype html public "-//W3C//DTD HTML 4.0 Frameset//EN""http://www.w3.org/TR/REC-html40/frameset.dtd">
<html>
<head>
<title>
 Overview
</title>
<link rel ="stylesheet" type="text/css" href="stylesheet.css" title="Style">
<script>
function asd() {
	
		parent.document.title="register-assistant.js Overview";
	
}
</script>
</head>
<body bgcolor="white" onload="asd();">

<!-- ========== START OF NAVBAR ========== -->
<a name="navbar_top"><!-- --></a>
<table border="0" width="100%" cellpadding="1" cellspacing="0">
<tr>
<td colspan=2 bgcolor="#EEEEFF" class="NavBarCell1">
<a name="navbar_top_firstrow"><!-- --></a>
<table border="0" cellpadding="0" cellspacing="3">
  <tr align="center" valign="top">
  
  
  <td bgcolor="#EEEEFF" class="NavBarCell1">    <a href="overview-summary.html"><font class="NavBarFont1"><b>Overview</b></font></a>&nbsp;</td>
  <td bgcolor="#FFFFFF" class="NavBarCell1Rev">	&nbsp;<font class="NavBarFont1Rev"><b>File</b></font>&nbsp;</td>
  

  <td bgcolor="#FFFFFF" class="NavBarCell1"> 	<font class="NavBarFont1">Class</font>&nbsp;</td>
  <td bgcolor="#EEEEFF" class="NavBarCell1">    <a href="overview-tree.html"><font class="NavBarFont1"><b>Tree</b></font></a>&nbsp;</td>
  <td bgcolor="#EEEEFF" class="NavBarCell1">    <a href="index-all.html"--><font class="NavBarFont1"><b>Index</b></font></a>&nbsp;</td>
  <td bgcolor="#EEEEFF" class="NavBarCell1">    <a href="help-doc.html"><font class="NavBarFont1"><b>Help</b></font></a>&nbsp;</td>
  </tr>
</table>
</td>
<td bgcolor="#EEEEFF" align="right" valign="top">
<em>
<b></b></em>
</td>
</tr>

<tr>
<td bgcolor="white" class="NavBarCell2"><font size="-2">
&nbsp;PREV&nbsp;
&nbsp;NEXT</font></td>
<td bgcolor="white" class="NavBarCell2"><font size="-2">
  <a href="index.html" target="_top"><b>FRAMES</b></a>  &nbsp;
&nbsp;<a href="overview-summary.html" target="_top"><b>NO FRAMES</b></a>
&nbsp;&nbsp;
<script>
  <!--
  if(window==top) {
    document.writeln('<A HREF="allclasses-noframe.html" TARGET=""><B>All Classes</B></A>');
  }
  //-->
</script>
<noscript>
<a href="allclasses-noframe.html" target=""><b>All Classes</b></a>
</noscript>
</font></td>
</tr>
</table>
<!-- =========== END OF NAVBAR =========== -->

<hr>
<center>
	
	   <h2>register-assistant.js</h2>
	
</center>

	


<h4>Summary</h4>
<p>
	
		No overview generated for 'register-assistant.js'<BR/><BR/>
	
</p>

<hr>


    <table border="1" cellpadding="3" cellspacing="0" width="100%">
    <tr bgcolor="#CCCCFF" class="TableHeadingColor">
    <td colspan=2><font size="+2">
    
        <b>Class Summary</b>
    
    </font></td>
    </tr>
    
    <tr bgcolor="white" class="TableRowColor">
    <td width="15%"><b><a href="RegisterAssistant.html">RegisterAssistant</a></b></td>
    <td>&nbsp;</td>
    </tr>
    
    </table>
    <hr/> 


<!-- ========== METHOD SUMMARY =========== -->

<!-- ========== END METHOD SUMMARY =========== -->


        <pre class="sourceview"><span class="reserved">function</span> RegisterAssistant(params) {
	<span class="comment">/** this is the creator function for your scene assistant object. It will be passed all the 
	*   additional parameters (after the scene name) that were passed to pushScene. The reference
	*   to the scene controller (this.controller) has not be established yet, so any initialization
	*   that needs the scene controller should be done in the setup function below.
	*/</span>
	  <span class="reserved">this</span>.userInfo = params;
}

<span class="comment">/** this function is for setup tasks that have to happen when the scene is first created 
*/</span>
RegisterAssistant.<span class="reserved">prototype</span>.setup = <span class="reserved">function</span>() {
	<span class="comment">/** use Mojo.View.render to render view templates and add them to the scene, if needed.
	 */</span>
	
	<span class="comment">/** setup widgets here-
	 * Instantiates UI widgets for login scene. Each widget requires attributes and a model.
	 * These are passed to the widget in a JSON object.
	 */</span>
	<span class="reserved">this</span>.controller.setupWidget(<span class="literal">"username"</span>,
          <span class="reserved">this</span>.usernameAttributes = {
              hintText: $L(<span class="literal">'Type your username...'</span>),
              autoFocus: true,
			  preventResize: true,
			  focusMode: Mojo.Widget.focusSelectMode,
			  autoReplace: false,
			  maxLength: 25,
			  textCase: Mojo.Widget.steModeLowerCase
          },
          <span class="reserved">this</span>.usernameModel = {
              value: <span class="reserved">this</span>.userInfo.username,
              disabled: false
     });
	 
	 <span class="reserved">this</span>.controller.setupWidget(<span class="literal">"password"</span>,
          <span class="reserved">this</span>.passwordAttributes = {
              hintText: $L(<span class="literal">'Type your password...'</span>),
			  preventResize: true,
			  focusMode: Mojo.Widget.focusSelectMode,
			  maxLength: 100,
          },
          <span class="reserved">this</span>.passwordModel = {
              value: <span class="reserved">this</span>.userInfo.password
     });
	 
	 <span class="reserved">this</span>.controller.setupWidget(<span class="literal">"confirmpassword"</span>,
          <span class="reserved">this</span>.confirmpasswordAttributes = {
              hintText: $L(<span class="literal">'Re-type your password...'</span>),
			  preventResize: true,
			  focusMode: Mojo.Widget.focusSelectMode,
			  maxLength: 100,
          },
          <span class="reserved">this</span>.confirmpasswordModel = {
              value: <span class="literal">""</span>
     });

	<span class="reserved">this</span>.controller.setupWidget(<span class="literal">"emailaddress"</span>,
          <span class="reserved">this</span>.emailaddressAttributes = {
              hintText: $L(<span class="literal">'Type your email address...'</span>),
              autoFocus: false,
			  preventResize: true,
			  focusMode: Mojo.Widget.focusSelectMode,
			  autoReplace: false,
			  maxLength: 50,
			  textCase: Mojo.Widget.steModeLowerCase
          },
          <span class="reserved">this</span>.emailaddressModel = {
              value: <span class="literal">""</span>,
              disabled: false
     });
	 
	 <span class="reserved">this</span>.controller.setupWidget(<span class="literal">"submitRegistrationButton"</span>,
         <span class="reserved">this</span>.submitRegistrationButtonAttributes = {
		 	type: Mojo.Widget.activityButton
             },
         <span class="reserved">this</span>.submitRegistrationButtonModel = {
             label : <span class="literal">"Submit Registration"</span>,
             disabled: false
    });
	
	
	<span class="comment">/** add event handlers to listen to events from widgets
	 */</span>
	<span class="reserved">this</span>.submitRegistrationButtonHandler = <span class="reserved">this</span>.submitRegistrationButton.bindAsEventListener(<span class="reserved">this</span>);
}

<span class="comment">/** put in event handlers here that should only be in effect when this scene is active. For
	 * example, key handlers that are observing the document
	 * When the scene is activated, start the event listeners for taps on the
	 * 'Submit Registration' button.
	 */</span>
RegisterAssistant.<span class="reserved">prototype</span>.activate = <span class="reserved">function</span>(event) {
	
	  Mojo.Event.listen(<span class="reserved">this</span>.controller.get(<span class="literal">'submitRegistrationButton'</span>),Mojo.Event.tap,<span class="reserved">this</span>.submitRegistrationButtonHandler);
}

<span class="comment">/** remove any event handlers you added in activate and do any other cleanup that should happen before
	  * this scene is popped or another scene is pushed on top
	  */</span>
RegisterAssistant.<span class="reserved">prototype</span>.deactivate = <span class="reserved">function</span>(event) {
	
	  Mojo.Event.stopListening(<span class="reserved">this</span>.controller.get(<span class="literal">'submitRegistrationButton'</span>),Mojo.Event.tap,<span class="reserved">this</span>.submitRegistrationButtonHandler);
}
<span class="comment">/** this function should do any cleanup needed before the scene is destroyed as
	 *  a result of being popped off the scene stack
	 */</span>
RegisterAssistant.<span class="reserved">prototype</span>.cleanup = <span class="reserved">function</span>(event) {
	
}

<span class="comment">/** This function is called when the submit button is pressed. It will connect to the mySQL
 * database on the BMC Studios LLC. server and register a new user. 
 */</span>
RegisterAssistant.<span class="reserved">prototype</span>.submitRegistrationButton = <span class="reserved">function</span>(event) {
	<span class="reserved">if</span>(!event)
		<span class="reserved">return</span>;
	var userInfo = {
		<span class="literal">'username'</span>: <span class="reserved">this</span>.usernameModel.value,
		<span class="literal">'password'</span>: <span class="reserved">this</span>.passwordModel.value,
		<span class="literal">'confirmpassword'</span>: <span class="reserved">this</span>.confirmpasswordModel.value,
		<span class="literal">'emailaddress'</span>: <span class="reserved">this</span>.emailaddressModel.value
	};
	<span class="reserved">this</span>.regUser(userInfo);
}

<span class="comment">/** This function does a remote server call to a registration script.
 * <span class="attrib">@param</span> UI User information.
 */</span>
RegisterAssistant.<span class="reserved">prototype</span>.regUser = <span class="reserved">function</span>(UI) {    
    var url = <span class="literal">"http://www.bmcstudiosllc.com/starmap/"</span> + <span class="literal">"mobile_reg.php"</span>;

    try{
        var request = new Ajax.Request(url,
        {
            method:<span class="literal">'get'</span>,
            parameters: {<span class="literal">'username'</span>: UI.username, <span class="literal">'password'</span>: UI.password, <span class="literal">'confirmpassword'</span>: UI.confirmpassword, <span class="literal">'emailaddress'</span>: UI.emailaddress}, 
            evalJSON:<span class="literal">'true'</span>,
            onComplete: <span class="reserved">this</span>.authUserCallback.bind(<span class="reserved">this</span>),
        });
    }
    catch (e)
    {
        Mojo.log.error(e);
        <span class="reserved">return</span> 0;
    }
}

<span class="comment">/** Callback function for regUser.  It either outputs an error message or if the
 * registration was successful.
 * <span class="attrib">@param</span> ajaxResponse The response from the remote server call.
 */</span>
RegisterAssistant.<span class="reserved">prototype</span>.authUserCallback = <span class="reserved">function</span>(ajaxResponse) {
	<span class="reserved">this</span>.controller.get(<span class="literal">'registerButton'</span>).mojo.deactivate();
	<span class="reserved">if</span> (ajaxResponse.responseJSON.returnCode != 1) {
		Mojo.Controller.errorDialog(ajaxResponse.responseJSON.message);
	} <span class="reserved">else</span> {
		<span class="reserved">this</span>.controller.stageController.popScene(ajaxResponse.responseJSON);
	}
}</pre>
	<hr>



<!-- ========== START OF NAVBAR ========== -->
<a name="navbar_top"><!-- --></a>
<table border="0" width="100%" cellpadding="1" cellspacing="0">
<tr>
<td colspan=2 bgcolor="#EEEEFF" class="NavBarCell1">
<a name="navbar_top_firstrow"><!-- --></a>
<table border="0" cellpadding="0" cellspacing="3">
  <tr align="center" valign="top">
  
  
  <td bgcolor="#EEEEFF" class="NavBarCell1">    <a href="overview-summary.html"><font class="NavBarFont1"><b>Overview</b></font></a>&nbsp;</td>
  <td bgcolor="#FFFFFF" class="NavBarCell1Rev">	&nbsp;<font class="NavBarFont1Rev"><b>File</b></font>&nbsp;</td>
  

  <td bgcolor="#FFFFFF" class="NavBarCell1"> <font class="NavBarFont1">Class</font>&nbsp;</td>
  <td bgcolor="#EEEEFF" class="NavBarCell1">    <a href="overview-tree.html"><font class="NavBarFont1"><b>Tree</b></font></a>&nbsp;</td>
  <td bgcolor="#EEEEFF" class="NavBarCell1">    <a href="index-all.html"--><font class="NavBarFont1"><b>Index</b></font></a>&nbsp;</td>
  <td bgcolor="#EEEEFF" class="NavBarCell1">    <a href="help-doc.html"><font class="NavBarFont1"><b>Help</b></font></a>&nbsp;</td>
  </tr>
</table>
</td>
<td bgcolor="#EEEEFF" align="right" valign="top"><em>
<b></b></em>
</td>
</tr>

<tr>
<td bgcolor="white" class="NavBarCell2"><font size="-2">
&nbsp;PREV&nbsp;
&nbsp;NEXT</font></td>
<td bgcolor="white" class="NavBarCell2"><font size="-2">
  <a href="index.html" target="_top"><b>FRAMES</b></a>  &nbsp;
&nbsp;<a href="overview-summary.html" target="_top"><b>NO FRAMES</b></a>
&nbsp;&nbsp;
<script>
  <!--
  if(window==top) {
    document.writeln('<A HREF="allclasses-noframe.html" TARGET=""><B>All Classes</B></A>');
  }
  //-->
</script>
<noscript>
<a href="allclasses-noframe.html" target=""><b>All Classes</b></a>
</noscript>
</font></td>
</tr>
</table>
<!-- =========== END OF NAVBAR =========== -->

<hr>
<font size="-1">

</font>
<div class="jsdoc_ctime">Documentation generated by <a href="http://jsdoc.sourceforge.net/" target="_parent">JSDoc</a> on Thu May  6 17:21:45 2010</div>
</body>
</html>
